import baseapi from '@/api/base'
import { getDataByParameter, getObjetInfoByPid, getCountByParameter, saveObjetInfo, deleteObjetInfo } from '@/utils/baserequest'
import storage from 'store'

const Base64 = require('js-base64').Base64

const api = {
  appContext: baseapi.biz,
  appAppId: baseapi.biz_app,
  appServer2: 'zhengZhaoTuPian',

  getZZImgByzzpid:'/by/zhengZhaoPid',
  addLicenseImg:'zhengZhaoTuPian'

}

export default api 

// 通过证照pid得到证照图片信息 
export function getZZImgByzzpid(parameter, headers) {
  const appIdHeaders = {
    appId: api.appAppId,
    org: storage.get('org'),
    authOption: (headers && headers.authOption && headers.authOption !== 'undefined') ? headers.authOption : '1'
  }
  headers == null ? headers = {} : ''
  const url = api.appContext + api.appServer2+api.getZZImgByzzpid
  const allheaders = Object.assign(headers, appIdHeaders)
  return getDataByParameter(url, parameter, allheaders)
}

//新增证照
export function addLicenseImg(parameter,headers){
  const appIdHeaders = {
    appId: api.appAppId,
    org: storage.get('org')
  }
  const url = api.appContext+api.addLicenseImg
  headers==null?headers={}:''
  const allheaders = Object.assign(headers, appIdHeaders)
  return saveObjetInfo(url, parameter, allheaders)
}
//新增删除
export function deleteLicenseImg(parameter,headers){
  const appIdHeaders = {
    appId: api.appAppId,
    org: storage.get('org')
  }
  const url = api.appContext+api.addLicenseImg
  headers==null?headers={}:''
  const allheaders = Object.assign(headers, appIdHeaders)
  return deleteObjetInfo(url, parameter, allheaders)
}




